<template>
	<view class="h_100">
		<view class="mt-5" v-if="u_loadmore">
			<u-loadmore status="loading" icon-type="circle" />
		</view>
		<view class="h_100" v-else>
			<view v-if="underList.length<=0" class="d-flex flex-column w-100 a-center j-center h_100">
				<image src="../../static/images/home/icon_no_data.png" mode="" class="icon_no_data"></image>
				<view class="">暂无商品</view>
			</view>
			<view v-else  class="goods_card bg-white m-2 p-3 rounded-20" v-for="(item,index) in underList" :key="index">
				<view class="goods_card_head d-flex"  @click="goodsEdit(item)">
					<view class="goods_card_head_left position-relative ">
						<view v-if="item.has_product=='yes'" class="text-white goods_logo">多货品</view>
						<image class="img_url" :src="item.img.url?item.img.url:defaltImage" mode="aspectFit"></image>
						<view class="position-absolute top-0 left-0 z-222" v-if="item.goods_video_url">
							<image src="../../static/images/goods/video.png" mode="" class="video_img"></image>
						</view>
					</view>
					<view class="goods_card_head_right pl-3">
						<view class="d-flex">
							<view class="ellipsis pro_name">
								<image v-if="item.is_hot" src="../../static/images/goods/icon_goods_hot.png" class="mr" mode=""></image>
								<image v-if="item.is_new" src="../../static/images/goods/icon_goods_new.png" class="mr" mode=""></image>
								<image v-if="item.is_best" src="../../static/images/goods/icon_goods_best.png" class="mr" mode=""></image>
								<image v-if="item.is_promote" src="../../static/images/goods/promotion.png" class="mr" mode=""></image>
								{{item.name}}
							</view>
						</view>
						<view class="text-light-muted font-md my pt-2">
							<text class="mr-3">库存：{{item.stock}}</text>
							<text>销量：{{item.sales_volume}}</text>
						</view>
						<view class="mt-1 pt">
							<text class="text-danger mr-2 font-35">{{item.shop_price}}</text><text class="font-md text-light-muted tex line-through">{{item.market_price}}</text>
						</view>
					</view>
				</view>
				<view class="mt-2 font d-flex j-end" >
					<view class="goods_card_content_footer" v-for="(underItem,underIndex) in items" :key="underIndex" @click="goods_under(underItem,item)">
						<view>{{underItem.title}}</view>
					</view>
				</view>
			</view>
			<view v-if="underList" class="text-center w-100 pb-2 font text-muted d-flex a-center j-center">加载中</view>
		</view>
	</view>
</template>

<script>
	import sPopup from '../../components/s-popup/index.vue';
	import {mapState} from 'vuex';
	export default {
		data(){
			return {
				defaltImage:'../../static/images/goods/icon_default_image.png',
				items:[
					{title:"上架",mind_id:1,offShow:false},
					{title:"智能权重",del_id:1,delShow:false},
					{title:"删除",del_id:1,delShow:false},
				],
				session:uni.getStorageSync('session'), // session信息
				getupShow:false, // 上架
				weightShow:false, // 智能权重
				recycleShow:false, // 商品回收
				
				u_loadmore:false, // 加载中
			}
		},
		computed:{
			...mapState({
				token:state=>state.user.token,
			})
		},
		props:["underList"],
		methods:{
			goodsEdit(item){
				this.$emit("goodsDetail",item)
			},
			goods_under(underItem,item){
				this.$emit("goods_under",underItem,item)
			}
		},
		updated() {
			console.log(this.underList)
		}
	}
</script>

<style>
	
</style>
